//
//  LineView.m
//  yuikemall
//
//  Created by Gang.Wang on 12-6-2.
//  Copyright (c) 2012年 yuike. All rights reserved.
//

#import "LineView.h"
#import "header.h"


@interface LineView()
{
    CALayer * solidUnderline;
    CALayer *bot;
}
- (void) privateInit;
@end

@implementation LineView

- (void) dealloc
{
    YRelease(solidUnderline)
    YRelease(bot)
    
    [super dealloc];
}


- (id) init
{
    self = [super init];
    if (self) {
        [self privateInit];
    }
    return self;
}

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        [self privateInit];
    }
    return self;
}

- (void) privateInit
{
    if (solidUnderline) 
    {
        return;
    }
    
    solidUnderline = [[CALayer layer] retain];
    
    solidUnderline.backgroundColor =
    [UIColor colorWithWhite:0.90f alpha:1].CGColor;
  
    
    bot = [[CALayer layer] retain];
    
    bot.backgroundColor = [UIColor whiteColor].CGColor;
    [solidUnderline addSublayer:bot];
    
    [[self layer] addSublayer:solidUnderline];
    
    
    [self reAdjustLayout];
}

- (void) setFrame:(CGRect)frame
{
    [super setFrame:frame];
    [self reAdjustLayout];
}

- (void) reAdjustLayout
{
    CGRect frame = self.frame;
    frame.size.height = 2;
//    [super setFrame:frame];
    
    bot.frame = CGRectMake(0, 1, self.width, 1);
    solidUnderline.frame = CGRectMake(0, 0, self.width, 2);

}

@end
